{% include "../common/header.html" %}
<form class="form form-horizontal" id="form-article-add">
    <input type="hidden" value="" id="aid" />
    <div class="row cl">
        <input type="hidden" value="{{item.id}}" id="tid" />
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>角色(英文)：</label>
        <div class="formControls col-xs-8 col-sm-9">
            <input type="text" class="input-text role" value="{{item.role}}" placeholder="" id="" name="">
        </div>
    </div>
    <div class="row cl">
        <input type="hidden" value="{{item.id}}" id="tid" />
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>角色名称：</label>
        <div class="formControls col-xs-8 col-sm-9">
            <input type="text" class="input-text itemname" value="{{item.rolename}}" placeholder="" id="" name="">
        </div>
    </div>
    <div class="row cl">
        <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
            <button class="btn btn-secondary radius" id="saveitem" type="button"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
            <button onClick="window.location.href='/{{action}}'" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
        </div>
    </div>
</form>
{% include "../common/footer.html" %}


<script>
$("#saveitem").click(function(){
    var newData={
        id:$("#tid").val(),
        role:$(".role").val(),
        rolename:$(".itemname").val(),

    }
    $.ajax({
        url:'/role/save',
        data:newData,
        type:'POST',
        success:function(json){
            if(json.errno===0){
                alert("保存成功！");
                window.location.href="/role"
            }else{
                alert(json.errmsg)
            }
        }
    })
})
</script>
